package priv.ln.communication.exer;

/**
 * ClassName: Consumer
 * Package: priv.ln.communication.exer
 * Description:
 * 消费者类
 *
 * @Author 辣辣
 * @Create 2024/7/21 15:36
 * @Version 1.0
 */
public class Consumer extends Thread {
    private Clerk clerk;

    public Consumer(Clerk clerk) {
        this.clerk = clerk;
    }

    @Override
    public void run() {
        while (true) {
            System.out.println("消费者开始消费产品...");

            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            clerk.minusProduct();

        }

    }
}
